package com.wutao.panzh.admin.content.controller.imageUpload;

import com.panzh.myconst.HttpConst;
import com.panzh.util.ImageUtil;
import org.csource.fastdfs.ClientGlobal;
import org.csource.fastdfs.StorageClient;
import org.csource.fastdfs.TrackerClient;
import org.csource.fastdfs.TrackerServer;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author：吴涛涛
 * 2020.1.6
 */
import java.util.*;

@Controller
public class DropzoneController {

    /**
     * 上传图片
     * @param dropFile 源文件对象
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "app/upload", method = RequestMethod.POST)
    public Map<String,Object> upload(MultipartFile dropFile) throws Exception {
        /**
         * 处理图片的大小，自己写的ImageUtil；我们必须要进行图片大小的处理，不然到时候展示在页面中会非常的丑！
         */
        byte[] inByte = dropFile.getBytes();
        return ImageUtil.uploadImag(inByte,800,600,true);
    }
}
